// 拿到登录状态
import React,{useContext,useEffect} from 'react'

import { AuthContext } from '../App';

const Header=()=>{
    const {state,dispatch}=useContext(AuthContext);
    // useEffect(()=>{
    //     setTimeout(()=>{
    //     dispatch({type:'LOGIN',payload:{isAuthenticated:true,user:{name:'keli'}}})
    //     },2000)
    // },[])
    console.log(state);
    return (
        <nav id='navigation'>
            <h1 href='#' className='logo'>
                Hooked
            </h1>
            <button onClick={()=>{dispatch({
                type:'LOGOUT'
            })}}>
                <h1>Log out</h1>
            </button>
        </nav>
    )
}

export default Header